﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ProductQuantity.aspx.cs" Inherits="Provider.ProductQuantity" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $('#MainContent_txtAddedQuantity').change(function () {
                ComputeTotalPrice();
            });
            $('#MainContent_txtTransportPrice').change(function () {
                ComputeTotalPrice();
            });
        });

        function ComputeTotalPrice() {
            var quantity = parseInt($('#MainContent_txtAddedQuantity').val());
            var unitPrice = parseFloat($('#MainContent_txtUnitPice').val());
            var transportPrice = parseFloat($('#MainContent_txtTransportPrice').val());

            quantity = isNaN(quantity) ? 0 : quantity;
            unitPrice = isNaN(unitPrice) ? 0 : unitPrice;
            transportPrice = isNaN(transportPrice) ? 0 : transportPrice;

            var totalPrice = quantity * unitPrice + transportPrice;

            $('#MainContent_txtTotalPrice').val(totalPrice);
            $('#MainContent_txtTotalPrice').parseNumber({ format: "#,###.00", locale: "us" });
            $('#MainContent_txtTotalPrice').formatNumber({ format: "#,###.00", locale: "us" });
            $('#MainContent_txtTransportPrice').parseNumber({ format: "#,###.00", locale: "us" });
            $('#MainContent_txtTransportPrice').formatNumber({ format: "#,###.00", locale: "us" });

            if (transportPrice == 0) {
                $('#MainContent_txtTransportPrice').val('');
            }
            if (totalPrice == 0) {
                $('#MainContent_txtTotalPrice').val('');
            }
        }

    </script>
    <div class="content-box-header">
        <h3>
            Cập nhật kho</h3>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
            <!-- This is the target div. id must match the href of this div's tab -->
            <div class="notification png_bg message" id="message" runat="server">
                <a href="#" class="close">
                    <img src="Images/Icons/cross_grey_small.png" title="Đóng thông báo" alt="close" /></a>
                <div>
                    <asp:Label ID="lblMessage" runat="server" Text="Label"></asp:Label>
                </div>
            </div>
            <fieldset>
                <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                <p>
                    <asp:Label ID="Label3" runat="server" Text="Nhà kinh doanh" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtPartnerName" runat="server" CssClass="text-input medium-input"
                        ReadOnly="true"></asp:TextBox>
                </p>
                <p>
                    <asp:Label ID="Label1" runat="server" Text="Tên sản phẩm" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtProductName" runat="server" CssClass="text-input medium-input"
                        ReadOnly="true"></asp:TextBox>
                </p>
                <p>
                    <asp:Label ID="Label5" runat="server" Text="Đơn giá" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtUnitPice" runat="server" CssClass="text-input tiny-input" ReadOnly="true"
                        Style="text-align: right"></asp:TextBox>
                </p>
                <p>
                    <asp:Label ID="Label8" runat="server" Text="Tồn kho tối thiểu" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtMinQuantity" runat="server" CssClass="text-input tiny-input"
                        ReadOnly="true" Style="text-align: right"></asp:TextBox>
                </p>
                <p>
                    <asp:Label ID="Label2" runat="server" Text="SL tồn" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtQuantity" runat="server" CssClass="text-input tiny-input" ReadOnly="true"
                        Style="text-align: right"></asp:TextBox>
                </p>
                <p>
                    <asp:Label ID="Label4" runat="server" Text="SL cập nhật" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtAddedQuantity" runat="server" CssClass="text-input tiny-input"
                        Style="text-align: right"></asp:TextBox>
                </p>
                <p>
                    <asp:Label ID="Label6" runat="server" Text="Vận chuyển" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtTransportPrice" runat="server" CssClass="text-input tiny-input"
                        Style="text-align: right"></asp:TextBox>
                </p>
                <p>
                    <asp:Label ID="Label7" runat="server" Text="Tổng cộng" Width="100px"></asp:Label>
                    <asp:TextBox ID="txtTotalPrice" runat="server" CssClass="text-input tiny-input" ReadOnly="true"
                        Style="text-align: right"></asp:TextBox>
                </p>
            </fieldset>
            <asp:Button ID="btnUpdateInventory" runat="server" Text="Cập nhật kho" CssClass="button"
                OnClick="btnUpdateInventory_Click" />
        </div>
        <!-- End #tab1 -->
    </div>
    <!-- End .content-box-content -->
</asp:Content>
